package com.ljh.api;

import com.ljh.api.model.ProductInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "product-service", path = "/product")
public interface ProductApi {
    @GetMapping("/{productId}")
    ProductInfo getProductById(@PathVariable("productId") Integer productId);

    @RequestMapping("/p1")
    String p1(@RequestParam("id") Integer id); // ! @RequestParam 不可省略

    @RequestMapping("/p2")
    String p2(@RequestParam("id") Integer id, @RequestParam("name") String name);

    @RequestMapping("/p3")
    String p3(@SpringQueryMap ProductInfo productInfo); // ! 必须使用 @SpringQueryMap 接收对象

    @RequestMapping("/p4")
    String p4(@RequestBody ProductInfo productInfo);
}
